package com.hks.quart.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.hks.common.core.entity.BaseEntity;
import com.hks.quart.utils.LongJsonDeserializer;
import com.hks.quart.utils.LongJsonSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author zhanglq
 * @version 1.0
 * @date 2021/9/1 15:11
 * @info 定时任务执行日志model
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("schedule_job_log")
public class ScheduleJobLogBean extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "log_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = LongJsonSerializer.class)
    @JsonDeserialize(using = LongJsonDeserializer.class)
    private Long logId;

    @TableField(value = "job_id")
    @JsonSerialize(using = LongJsonSerializer.class)
    @JsonDeserialize(using = LongJsonDeserializer.class)
    private Long jobId;

    /**
     * 定时器实例名
     */
    @TableField(value = "bean_name")
    private String beanName;
    /**
     * 定时任务名称
     */
    @TableField(value = "quartz_name")
    private String quartzName;
    /**
     * 参数
     */
    @TableField(value = "params")
    private String params;

    /**
     * 执行的是否成功的状态0表示成功，1表示失败
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 错误日志
     */
    @TableField(value = "error")
    private String error;


    /**
     * 执行后的返回结果
     */
    @TableField(value = "result")
    private String result;

    /**
     * 运行耗时
     */
    @TableField(value = "times")
    private Integer times;
}
